﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Having.Site.Data.Attr
{
    /// <summary>
    /// (只能应用在属性上)表示用于标志类的关键使用方式（例如唯一值，例如guid/ID）
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public class AttKeyName : System.Attribute
    {
        /// <summary>
        /// 是否自增列
        /// </summary>
        public AttKeyType KeyType { set; get; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="_KeyType">是否自增列(默认为false)</param>
        public AttKeyName(AttKeyType _KeyType = AttKeyType.Ordinary)
        { KeyType = _KeyType; }
    }

    /// <summary>
    /// 列的说明（暂时无用）
    /// </summary>
    public enum AttKeyType {
        /// <summary>
        /// 普通列
        /// </summary>
        Ordinary = 0,
        /// <summary>
        /// 主键
        /// </summary>
        Key = 1,
        /// <summary>
        /// 自增
        /// </summary>
        Incr = 2,
        /// <summary>
        /// 主键并且是自增列
        /// </summary>
        KeyAndIncr = 3,
        /// <summary>
        /// 排除列（在add和updata排除）
        /// </summary>
        Retain = 4
    }
}
